﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PalFramework.Template;

namespace PalBattleEmulator.Object.Effect
{
    public static class EffectFactory
    {
        private const int ENEMY_SINGLE_UNIT = 0;
        private const int ENEMY_MULTI_UNIT = 1;
        private const int ENEMY_SIDE = 2;
        private const int ENEMY_WHOLE_MAP = 3;

        private const int DEFALT_EFFECT_SPEED = 5;

        public static Effect[] createMagicEffects(int tmplId, int posX, int posY)
        {
            IMagicEffectTmpl effectTmpl = ContextModules.MagicEffectTmplManager.GetTmpl(tmplId);
            List<Effect> effects = new List<Effect>();
            switch (effectTmpl.DrawType)
            {
                case ENEMY_SINGLE_UNIT:
                    Effect effect = new Effect();
                    effect.Id = effectTmpl.ImageIndex;
                    effect.PosX = posX + effectTmpl.XRevise;
                    effect.PosY = posY + effectTmpl.YRevise;
                    //effect.ZIndex = effectTmpl.
                    effect.Speed = effectTmpl.Speed + DEFALT_EFFECT_SPEED;
                    effect.Delay = effectTmpl.Delay;
                    effect.RepeatTimes = effectTmpl.Times;
                    effects.Add(effect);
                    break;
            }
            return effects.ToArray();
        }
    }
}
